# Rouleur Log - A log for cyclists.
# Copyright (C) 2006  Edward Copony (ecopony@gmail.com)
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

require 'weborb/context'
require 'rbconfig'

class BikeService < BaseService
  
  def getBikes
    bikes = Bike.find(:all, :conditions => "user_id = '" + getUserId() + "'")
  end
  
  def createBike(bike)
    new_bike = Bike.new(bike)
    new_bike.user_id = getUserId()
    new_bike.save
    new_bike
  end
  
  def updateBike(id, bike)
    update_bike = Bike.find(id)
    update_bike.update_attributes(bike)
    bike
  end
  
  def deleteBike(id)
    delete_bike = Bike.find(id)
    delete_bike.destroy
  end
  
end